const Router = require('koa-router')

let router = new Router()
router.prefix('/new')
router.get('/', async ctx => {
	if (!ctx.session.view) {
		ctx.session.view = 0
	}
	ctx.session.view++
	ctx.body = `new跟第${ctx.session.view}次进入`
})
router.get('/new', async ctx => {
	// let res = await ctx.db.query('SELECT * FROM baidunews')
	ctx.body = 'we'

})
router.post('/new', async ctx => {

	// let res = await ctx.db.query('SELECT * FROM baidunews')
	console.log(1)
	ctx.request.fields // 包含全部请求信息是对象
	ctx.request.files // 包含全部文件信息是数组
	ctx.body = 'we'

})
module.exports = router.routes()
